package com.andova.egl

import android.graphics.ImageFormat
import android.graphics.SurfaceTexture
import androidx.annotation.FloatRange
import com.andova.glcamera.DEFAULT_COLOR_FORMAT
import com.andova.glcamera.FrameAction
import com.andova.glcamera.GlFrameHThread

interface OnTextureListener {
    fun onAvailable(width: Int, height: Int)
    fun onSizeChanged(width: Int, height: Int)
    fun onDestroyed(surfaceTexture: SurfaceTexture?)
    fun onTextureFrame(surfaceTexture: SurfaceTexture?)
    fun onTaskFrame(surfaceTexture: SurfaceTexture?)
    fun onDelayTask(what: Int)
}

interface OnTextureBridger {
    fun rotateRadian(radian: Double)
    fun flipScale(@FloatRange(from = -1.0, to = 1.0) xFlipScale: Float, @FloatRange(from = -1.0, to = 1.0) yFlipScale: Float)
    fun lazyCallback(sleepMillisecond: Long)
    fun resume()
    fun pause(clearColor: Boolean)
    fun start(delayMillis: Long = 0L, format: Int = DEFAULT_COLOR_FORMAT)
    fun action(@FrameAction command: Int)
    fun handler(handler: GlFrameHThread?)
    fun x(@FloatRange(from = 0.1, to = 2.0) x: Float)
    fun y(@FloatRange(from = 0.1, to = 2.0) y: Float)
    fun obtainAction(): Int

    fun onPreviewFrame(buffer: ByteArray, format: Int = ImageFormat.YUV_420_888)
}